package com.chen.controller;

import com.chen.dao.BookMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BookController {

    @Autowired
    BookMapper bookMapper;


    @GetMapping("/save")
    @ResponseBody
    public String save() {
        bookMapper.saveBook("redis", "spring-redis-start");
        return "保存键值对成功！";
    }

    @GetMapping("/getValue")
    @ResponseBody
    public String getValue() {

        return bookMapper.getValue("redis");
    }
}
